package com.skyz.wrap.dialog;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager;

import com.skyz.base.dialog.BaseDialogFragment;
import com.skyz.base.util.ScreenUtils;
import com.skyz.wrap.R;

public class ReliefDailogFragment extends BaseDialogFragment {



    public static ReliefDailogFragment showDialogFragment(@NonNull FragmentManager manager,  View.OnClickListener listener) {
        ReliefDailogFragment loadingDialogFragment = new ReliefDailogFragment();
        loadingDialogFragment.config(listener);
        loadingDialogFragment.show(manager, null);
        return loadingDialogFragment;
    }
    View.OnClickListener listener;
    private void config( View.OnClickListener listener) {
        this.listener = listener;
    }


    private ReliefDailogFragment() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_fragment_relief;
    }



    @Override
    protected void onLayoutInflated(View view) {


        view.findViewById(R.id.tv_action).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (listener != null) {
                    listener.onClick(v);
                }
            }
        });
        setDialogCancelable(true);
        setDialogCanceledOnTouchOutside(true);
    }

    @Override
    protected WindowManager.LayoutParams initLayoutParams(WindowManager.LayoutParams layoutParams) {
        layoutParams.gravity = Gravity.CENTER;
        layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
        layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
        return layoutParams;
    }

    @Override
    protected void initData(Bundle savedInstanceState) {

    }
}
